package cn.com.gridinfo.sooc.core.course.info.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.jeremy.arad.utils.Log;
import com.marshalchen.ultimaterecyclerview.UltimateRecyclerviewViewHolder;
import com.marshalchen.ultimaterecyclerview.UltimateViewAdapter;

import java.util.List;

import cn.com.gridinfo.sooc.R;
import cn.com.gridinfo.sooc.core.course.discuss.bean.Discuss;
import cn.com.gridinfo.sooc.core.course.info.bean.Notice;
import cn.com.gridinfo.sooc.utils.DateUtil;

/**
 * 课程通知 adapter
 * Created by yingchunli on 2016/1/6.
 */
public class NoticeAdapter extends BaseAdapter {

    private List<Notice> noticeList;
    private Context context;

    public NoticeAdapter(List<Notice> noticeList, Context context) {
        this.noticeList = noticeList;
        this.context = context;
    }

    @Override
    public int getCount() {
        return noticeList.size();
    }

    @Override
    public Object getItem(int position) {
        return noticeList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        //加载布局
        convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.course_notice_item, null);
        TextView time;//时间
        TextView tznr;//通知内容
        time = (TextView) convertView.findViewById(R.id.time_notice_item);
        tznr = (TextView) convertView.findViewById(R.id.tznr_notice_item);
        tznr.setText(noticeList.get(position).getTznr());
        time.setText(DateUtil.getDateFromDatestamp(noticeList.get(position).getInput_time()));
        return convertView;
    }
}
